#include <SDL_mixer.h>
#include <iostream>

using namespace std;

namespace polaris
{
        class sound
        {
            public:
                sound(char* filename)
                {
                    audio_rate = 44100;
                    audio_format = AUDIO_S16; /* 16-bit stereo */
                    audio_channels = 2;
                    audio_buffers = 4096;

                    if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers))
                    {
                        printf("Unable to open audio!\n");
                        exit(-1);
                    }

                    music = Mix_LoadMUS(filename);

                    if(music==NULL)
                    {
                        cout << "Missing file: " << filename << endl;
                        exit(-1);
                    }
                }

                void play()
                {
                    Mix_PlayMusic(music, 0);
                }


            private:
                int audio_rate;
                Uint16 audio_format;
                int audio_channels;
                int audio_buffers;
                Mix_Music *music;


        };
}
